package com.blink.example.designpattern.adapter.section3;

import java.util.Map;

/**
 * @author cbf4Life cbf4life@126.com
 * I'm glad to share my knowledge with you all.
 * 把OuterUser包装成UserInfo
 */
@SuppressWarnings("all")
public class OuterUserInfo implements IUserInfo {
	//源目标对象
	private IOuterUserBaseInfo baseInfo = null;  //员工的基本信息
	private IOuterUserHomeInfo homeInfo = null; //员工的家庭 信息
	private IOuterUserOfficeInfo officeInfo = null; //工作信息
	
	//数据处理
	private Map baseMap = null;
	private Map homeMap = null;
	private Map officeMap = null;
	
	//构造函数传递对象
	public OuterUserInfo(IOuterUserBaseInfo _baseInfo,IOuterUserHomeInfo _homeInfo,IOuterUserOfficeInfo _officeInfo){
		this.baseInfo = _baseInfo;
		this.homeInfo = _homeInfo;
		this.officeInfo = _officeInfo;
		
		//数据处理
		this.baseMap = this.baseInfo.getUserBaseInfo();
		this.homeMap = this.homeInfo.getUserHomeInfo();
		this.officeMap = this.officeInfo.getUserOfficeInfo();
	}
	
	 //家庭地址
	@Override
    public String getHomeAddress() {
		String homeAddress = (String)this.homeMap.get("homeAddress");
		System.out.println(homeAddress);
		return homeAddress;
	}

	 //家庭电话号码
	@Override
    public String getHomeTelNumber() {
		String homeTelNumber = (String)this.homeMap.get("homeTelNumber");
		System.out.println(homeTelNumber);
		return homeTelNumber;
	}

	 //职位信息
	@Override
    public String getJobPosition() {
		String jobPosition = (String)this.officeMap.get("jobPosition");
		System.out.println(jobPosition);
		return jobPosition;
	}

	 //手机号码
	@Override
    public String getMobileNumber() {
		String mobileNumber = (String)this.baseMap.get("mobileNumber");
		System.out.println(mobileNumber);
		return mobileNumber;
	}

	 //办公电话
	@Override
    public String getOfficeTelNumber() {
		String officeTelNumber = (String)this.officeMap.get("officeTelNumber");
		System.out.println(officeTelNumber);
		return officeTelNumber;
	}
	
	// 员工的名称
	@Override
    public String getUserName() {
		String userName = (String)this.baseMap.get("userName");
		System.out.println(userName);
		return userName;
	}

}